package com.ruoyi.web.controller.tool;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.sms.SendSmsUtil;
import com.ruoyi.common.utils.sms.domain.SmsContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: MMDZ
 * @Desc: TODO 短信
 */
@RestController
@RequestMapping("/tool/sms")
public class SmsController {

    @Autowired
    private SendSmsUtil sendSmsUtil;

    @PreAuthorize("@ss.hasPermi('tool:sms:send')")
    @PostMapping("/send")
    public AjaxResult send(@Validated @RequestBody SmsContent smsContent) {
        return AjaxResult.success(sendSmsUtil.sendSms(smsContent.getToSmsPhone(), smsContent.getContent()));
    }

}
